<!-- <style>
#taskEditGantt table tbody tr td{
	border:0px solid #EEE;
	font-size:14px;
	background-color:#F9F9F9;
}
.calBox {
    color: #000 !important;
    background-color:#fff !important;
}
.calNav{
    background-color:#fff;
}
/* 消息提示  */
.closebtn{
    width: 60px;
    font-size: 14px !important;
    margin-right: -11px !important;
}
.hintTitle{
  font-size:18px;
  text-align:center;
  color:#528FCC;
}

</style>

<script type="text/javascript">


function insertWP(projectId){
	window.open('/pm/GanttAppletNewAction.do?method=showWorkProduct&projectId='+projectId,"_blank","width=850,height=600,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");

	  /* var wpTable = $("#wpTable");
	  // loop on assignments
	  var wp = obj;
	  var wpRow = $.JST.createFromTemplate({wp: wp}, "WORKPRODUCT_ROW");
	  wpTable.append(wpRow); */

}
var newWpId=-100;
var defaultTaskName="任务名称";
var isloaded=false;
function onLoaded()
{
	//alert("aaa");
	isloaded=true;
}

</script>

 -->
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE"/>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <title>甘特图</title>

  <link rel=stylesheet href="platform.css" type="text/css">
  <link rel=stylesheet href="libs/jquery/dateField/jquery.dateField.css" type="text/css">

  <link rel=stylesheet href="ganttTable.css" type="text/css">
  <link rel=stylesheet href="iconfont/iconfont.css" type="text/css">

	<link rel="stylesheet" href="libs/select2/select2.css" type="text/css"/>
  <link rel=stylesheet href="gantt.css" type="text/css">
  <link rel=stylesheet href="ganttPrint.css" type="text/css" media="print">
  <link rel=stylesheet href="iconfont/style.css" type="text/css">
  <script src="libs/jquery/jquery.min.js"></script>
  <script src="libs/jquery/jquery-ui.min.js"></script>
	<script src="libs/select2/select2.js" charset="utf-8" type="text/javascript"></script>
    <script src="data.js"></script>

   <!--[if lt IE 8]><!-->
   <link rel="stylesheet" href="iconfont/ie7/ie7.css">
   <!--<![endif]-->


  <script src="libs/jquery/jquery.livequery.1.1.1.min.js"></script>
  <script src="libs/jquery/jquery.timers.js"></script>

  <script src="libs/utilities.js"></script>
  <script src="libs/forms.js"></script>
  <script src="libs/date.js"></script>
  <script src="libs/dialogs.js"></script>
  <script src="libs/layout.js"></script>
  <script src="libs/i18nJs.js"></script>
  <script src="libs/jquery/dateField/jquery.dateField.js"></script>
  <script src="libs/jquery/JST/jquery.JST.js"></script>

  <script type="text/javascript" src="libs/jquery/svg/jquery.svg.min.js"></script>
  <script type="text/javascript" src="libs/jquery/svg/jquery.svgdom.1.8.js"></script>

  <script src="ganttUtilities.js"></script>
  <script src="ganttTask.js"></script>
  <script src="ganttTestReport.js"></script>
  <script src="ganttDrawerSVG.js"></script>
  <script src="ganttZoom.js"></script>
  <script src="ganttGridEditor.js"></script>
  <script src="ganttMaster.js"></script>
  <script src="iconfont/iconfont.js"></script>
	<script src="ganttLoopTask.js"></script>

  <!--<script src="libs/profiling.js"></script>-->
  <!--<script type="text/javascript" src="ganttTestSuite.js"></script>-->
</head>
<body style="background-color: #fff;">



<div id="workSpace" style="padding:0px; overflow-y:hidden; overflow-x:hidden;border:1px solid #e5e5e5;position:relative;margin:0 5px;width:99%;height:100%"></div>

<style>
  .resEdit {
    padding: 15px;
  }

  .resLine {
    width: 95%;
    padding: 3px;
    margin: 5px;
    border: 1px solid #d0d0d0;
  }

  body {
    overflow: hidden;
  }

  .ganttButtonBar h1{
    color: #000000;
    font-weight: bold;
    font-size: 28px;
    margin-left: 10px;
  }

</style>

<form id="gimmeBack" style="display:none;" action="/pm/GanttAppletNewAction.do?projectId=1" method="post" target="_parent"><input type="hidden" name="prj" id="gimBaPrj"></form>
  <input type="hidden" name="ProjID" id="ProjID" value='1'>
  <input type="hidden" name="holidaysSetting" id="holidaysSetting" value='##'>
  <input type="hidden" name="overtimeSetting" id="overtimeSetting" value='##'>
<script type="text/javascript">
var has_showModalDialog = !!window.showModalDialog;//定义一个全局变量判定是否有原生showModalDialog方法
if(!has_showModalDialog &&!!(window.opener)){
	window.οnbefοreunlοad=function(){
		window.opener.hasOpenWindow = false;		//弹窗关闭时告诉opener：它子窗口已经关闭
	}
}
//定义window.showModalDialog如果它不存在
if(window.showModalDialog == undefined){
	window.showModalDialog = function(url,features){
		if(window.hasOpenWindow){
			alert("您已经打开了一个窗口！请先处理它");//避免多次点击会弹出多个窗口
			window.myNewWindow.focus();
		}
		window.hasOpenWindow = true;
		//因window.showmodaldialog 与 window.open 参数不一样，所以封装的时候用正则去格式化一下参数
		//if(features) var features = features.replace(/(dialog)|(px)/ig,"").replace(/;/g,',').replace(/\:/g,"=");
		//window.open("Sample.htm",null,"height=200,width=400,status=yes,toolbar=no,menubar=no");
		//window.showModalDialog("modal.htm",obj,"dialogWidth=200px;dialogHeight=100px");
		//var left = (window.screen.width - parseInt(features.match(/width[\s]*=[\s]*([\d]+)/i)[1]))/2;
		//var top = (window.screen.height - parseInt(features.match(/height[\s]*=[\s]*([\d]+)/i)[1]))/2;
		window.myNewWindow = window.open(url,"_blank",features);
	}
}
var ge;
$(function() {
  var canWrite=true; //this is the default for test purposes

  // here starts gantt initialization
  ge = new GanttMaster();
  ge.set100OnClose=true;

  ge.shrinkParent=true;

  ge.init($("#workSpace"));
  loadI18n(); //overwrite with localized ones

  //in order to force compute the best-fitting zoom level
  delete ge.gantt.zoom;

  loadGanttFromServer();
});



function testFun(obj){
	alert("yes i can do "+obj);
}
var LOAD_GANT_TASK = true;
function loadGanttFromServer(taskId, callback) {
  //this is a simulation: load data from the local storage if you have already played with the demo or a textarea with starting demo data
  //var ret=loadFromLocalStorage();

  //this is the real implementation

  //var taskId = $("#taskSelector").val();
/*   var prof = new Profiler("loadServerSide");
  prof.reset(); */
  showdiv("正在从服务器加载数据,请稍候...");
    let data = exampleData;
	showdiv("数据加载完毕,开始绘图,请稍候...");
 	  LOAD_GANT_TASK = true;
	  ge.loadProject(data.project);
	  LOAD_GANT_TASK = false;
      ge.checkpoint(); //empty the undo stack

      hidediv();


  return ge.project;
}

var SHOW_MESSAGE = true;

function saveMessage(){
	if(SHOW_MESSAGE){
		saveProgress++;
		showdiv("正在处理上传数据,进度("+saveProgress+"%)");
		if(saveProgress>=99){
		    if(saveProgress>100){
                saveProgress = 100;
            }
			showdiv("正在刷新任务相关数据("+saveProgress+"%)");
			return;
		}
		if(saveProgress==30){
			setTimeout(saveMessage,5000);
		}else if(saveProgress==60){
			setTimeout(saveMessage,5000);
		}else if(saveProgress==70){
			setTimeout(saveMessage,5000);
		}else{
			setTimeout(saveMessage,50);
		}
	}
}
var saveProgress = 1;

function saveGanttOnServer() {
// 	alert(ge.projectCuttingReason);
  if(ge.__undoStack.length < 1){
	  alert("甘特图数据未发生变化，无需保存");
	  return ;
  }
  //this is a simulation: save data to the local storage or to the textarea
  //saveInLocalStorage();
  var reason = "--";
  var needReason = ge.needReason;
  if(ge.projectCuttingReason){
	  if(ge.needReason){
		  reason = prompt("已修改或者删除来自标准过程或项目模板导入的任务，请输入裁剪原因","");
	  }
  }

  var prj = ge.saveProject();

  delete prj.resources;
  delete prj.roles;
  prj.reason = reason;
  prj.needReason = needReason;
  prj.projectCuttingReason = ge.projectCuttingReason;
/*   var prof = new Profiler("saveServerSide");
  prof.reset(); */

  if (ge.deletedTaskIds.length>0) {
    if (!confirm("有"+ge.deletedTaskIds.length+"个任务即将被删除，是否继续？")) {
      return;
    }
  }
  showSaveDiv();
  setTimeout(saveMessage,1000);
  $.ajax("/pm/GanttAppletNewAction.do?method=saveTasks&t="+(new Date()).getTime(), {
    dataType:"json",
    data: {CM:"SVPROJECT",projectId:1,prj:JSON.stringify(prj)},
    type:"POST",

    success: function(response) {
      if (response.ok) {
 //   	  hideSaveDiv();
//		  showdiv("保存成功,正在刷新甘特图，请稍候...");
//         if (response.project) {
         // ge.loadProject(response.project); //must reload as "tmp_" ids are now the good ones
         //这里重新加载
          $.getJSON("/pm/GanttAppletNewAction.do?method=getTasks&t="+(new Date()).getTime(), {projectId:1, logId:-1}, function(response) {
		    if (response.ok) {
		      LOAD_GANT_TASK = true;
		      ge.loadProject(response.project);
		      LOAD_GANT_TASK = false;
		      ge.checkpoint(); //empty the undo stack
		      hideSaveDiv();

		      if (typeof(callback)=="function") {
		        callback(response);
		      }
		    } else {
		      jsonErrorHandling(response);
		    }
		  });


         //----
//         } else {
//           ge.reset();
//         }
      } else {
        var errMsg="Errors saving project\n";
        if (response.message) {
          errMsg=errMsg+response.message+"\n";
        }

        if (response.errorMessages.length) {
          errMsg += response.errorMessages.join("\n");
        }
	    hideSaveDiv();
        alert(errMsg);
      }
    },
    error:function(response){
    	hideSaveDiv();
    	var responseText = response.responseText;
        SHOW_MESSAGE  = false;
	     hideSaveDiv();
    	if(responseText){
	    	if(responseText.indexOf("或者长期未活动导致登陆过期")>0){
	    		hideShowMessage();
	    		alert("对不起，您尚未登录，或者长期未活动导致Session过期");
	    	}else{
	    		hideShowMessage();
		    	alert("保存异常");
	    	}
    	}else{
    		   hideShowMessage();
		    	alert("保存异常");

    	}
    }

  });
}

function newProject(){
  clearGantt();
}

function hideSaveDiv(){
	saveProgress=99;
	saveMessage();
	setTimeout(hideShowMessage,1000);
}
function showSaveDiv(){
	  SHOW_MESSAGE = true;
	  showdiv();
	  saveProgress = 1;
}
function hideShowMessage(){
	SHOW_MESSAGE = false;
	hidediv();
}
function clearGantt() {
  ge.reset();
}

//-------------------------------------------  Get project file as JSON (used for migrate project from gantt to Teamwork) ------------------------------------------------------
function getFile() {
  $("#gimBaPrj").val(JSON.stringify(ge.saveProject()));
  $("#gimmeBack").submit();
  $("#gimBaPrj").val("");

  /*  var uriContent = "data:text/html;charset=utf-8," + encodeURIComponent(JSON.stringify(prj));
   neww=window.open(uriContent,"dl");*/
}


function loadFromLocalStorage() {
  var ret;
  if (localStorage) {
    if (localStorage.getObject("teamworkGantDemo")) {
      ret = localStorage.getObject("teamworkGantDemo");
    }
  }

  //if not found create a new example task
  if (!ret || !ret.tasks || ret.tasks.length == 0){
   }
  return ret;
}


function saveInLocalStorage() {
  var prj = ge.saveProject();
  if (localStorage) {
    localStorage.setObject("teamworkGantDemo", prj);
  }
}


//-------------------------------------------  Open a black popup for managing resources. This is only an axample of implementation (usually resources come from server) ------------------------------------------------------
function editResources(){

  //make resource editor
  var resourceEditor = $.JST.createFromTemplate({}, "RESOURCE_EDITOR");
  var resTbl=resourceEditor.find("#resourcesTable");

  for (var i=0;i<ge.resources.length;i++){
    var res=ge.resources[i];
    resTbl.append($.JST.createFromTemplate(res, "RESOURCE_ROW"))
  }


  //bind add resource
  resourceEditor.find("#addResource").click(function(){
    resTbl.append($.JST.createFromTemplate({id:"new",name:"resource"}, "RESOURCE_ROW"))
  });

  //bind save event
  resourceEditor.find("#resSaveButton").click(function(){
    var newRes=[];
    //find for deleted res
    for (var i=0;i<ge.resources.length;i++){
      var res=ge.resources[i];
      var row = resourceEditor.find("[resId="+res.id+"]");
      if (row.length>0){
        //if still there save it
        var name = row.find("input[name]").val();
        if (name && name!="")
          res.name=name;
        newRes.push(res);
      } else {
        //remove assignments
        for (var j=0;j<ge.tasks.length;j++){
          var task=ge.tasks[j];
          var newAss=[];
          for (var k=0;k<task.assigs.length;k++){
            var ass=task.assigs[k];
            if (ass.resourceId!=res.id)
              newAss.push(ass);
          }
          task.assigs=newAss;
        }
      }
    }

    //loop on new rows
    var cnt=0
    resourceEditor.find("[resId=new]").each(function(){
      cnt++;
      var row = $(this);
      var name = row.find("input[name]").val();
      if (name && name!="")
        newRes.push (new Resource("tmp_"+new Date().getTime()+"_"+cnt,name));
    });

    ge.resources=newRes;

    closeBlackPopup();
    ge.redraw();
  });


  var ndo = createModalPopup(400, 500).append(resourceEditor);
}

function initializeHistoryManagement(){

  //si chiede al server se c'è della hisory per la root
  $.getJSON(contextPath+"/applications/teamwork/task/taskAjaxController.jsp", {CM: "GETGANTTHISTPOINTS", OBJID:10236}, function (response) {

    //se c'è
    if (response.ok == true && response.historyPoints && response.historyPoints.length>0) {

      //si crea il bottone sulla bottoniera
      var histBtn = $("<button>").addClass("button textual icon lreq30 lreqLabel").attr("title", "SHOW_HISTORY").append("<span class=\"teamworkIcon\">&#x60;</span>");

      //al click
      histBtn .click(function () {
        var el = $(this);
        var ganttButtons = $(".ganttButtonBar .buttons");


        if (!ge.element.is(".historyOn")) {
          ge.element.addClass("historyOn");
          ganttButtons.find(".requireCanWrite").hide();

          //si carica la history server side
          if (false) return;
          showSavingMessage();
          $.getJSON(contextPath + "/applications/teamwork/task/taskAjaxController.jsp", {CM: "GETGANTTHISTPOINTS", OBJID: ge.tasks[0].id}, function (response) {
            jsonResponseHandling(response);
            hideSavingMessage();
            if (response.ok == true) {
              var dh = response.historyPoints;
              //ge.historyPoints=response.historyPoints;
              if (dh && dh.length > 0) {
                //si crea il div per lo slider
                var sliderDiv = $("<div>").prop("id", "slider").addClass("lreq30 lreqHide").css({"display":"inline-block","width":"500px"});
                ganttButtons.append(sliderDiv);

                var minVal = 0;
                var maxVal = dh.length-1 ;

                $("#slider").show().mbSlider({
                  rangeColor : '#2f97c6',
                  minVal     : minVal,
                  maxVal     : maxVal,
                  startAt    : maxVal,
                  showVal    : false,
                  grid       :1,
                  formatValue: function (val) {
                    return new Date(dh[val]).format();
                  },
                  onSlideLoad: function (obj) {
                    this.onStop(obj);

                  },
                  onStart    : function (obj) {},
                  onStop     : function (obj) {
                    var val = $(obj).mbgetVal();
                    showSavingMessage();
                    $.getJSON(contextPath + "/applications/teamwork/task/taskAjaxController.jsp", {CM: "GETGANTTHISTORYAT", OBJID: ge.tasks[0].id, millis:dh[val]}, function (response) {
                      jsonResponseHandling(response);
                      hideSavingMessage();
                      if (response.ok ) {
                        ge.baselines=response.baselines;
                        ge.showBaselines=true;
                        ge.baselineMillis=dh[val];
                        ge.redraw();
                      }
                    })

                  },
                  onSlide    : function (obj) {
                    clearTimeout(obj.renderHistory);
                    var self = this;
                    obj.renderHistory = setTimeout(function(){
                      self.onStop(obj);
                    }, 200)

                  }
                });
              }
            }
          });


          // quando si spenge
        } else {
          //si cancella lo slider
          $("#slider").remove();
          ge.element.removeClass("historyOn");
          if (ge.permissions.canWrite)
            ganttButtons.find(".requireCanWrite").show();

          ge.showBaselines=false;
          ge.baselineMillis=undefined;
          ge.redraw();
        }

      });
      $("#saveGanttButton").before(histBtn);
    }
  })
}

function showBaselineInfo (event,element){
  //alert(element.attr("data-label"));
  $(element).showBalloon(event, $(element).attr("data-label"));
  ge.splitter.secondBox.one("scroll",function(){
    $(element).hideBalloon();
  })
}

function doInsertWP(ids){
	//alert(ids);
	var wpTable = $("#wpTable");
	$.ajax({
		type:'POST',
		url:"/pm/GanttAppletNewAction.do?method=getWP",
		data:{
			ids:ids,projectId:1
		},
		datatype:"json",
		async:true,

 		success: function(jsonResult){
    		$.each(jsonResult,function(key){
    			var productName = jsonResult[key]["productName"];
    			var sizeUnitStr = jsonResult[key]["sizeUnitStr"];
    			//var realSize = jsonResult[key]["realSize"];
    			var planSize = jsonResult[key]["planSize"];
    			var num = wpTable.find("input[name='productName'][value='"+productName+"']").length;
    			if(num>0)
    				return true;
    			var parentId = jsonResult[key]["parentId"];
    			var nwp={};
    			nwp.taskId=wpCurrenttaskId;
    			nwp.productId=newWpId;
    			nwp.parentId=parentId;
    			nwp.productName=productName;
    			//nwp.realSize=realSize;
    			nwp.planSize=planSize;
    			nwp.sizeUnitStr=sizeUnitStr;
    			var wpRow = $.JST.createFromTemplate({wp: nwp}, "WORKPRODUCT_ROW");
    			wpTable.append(wpRow);
    			newWpId--;
    		});
		},
		error:function(){
			alert("加载失败,服务器无响应");
		}
	});

	  /* var wpTable = $("#wpTable");
	  // loop on assignments
	  var wp = obj;
	  var wpRow = $.JST.createFromTemplate({wp: wp}, "WORKPRODUCT_ROW");
	  wpTable.append(wpRow); */

}
//我需要在项目里面加个图标，然后在图标上面加个方法
function beginImport(){
	if(ge.__undoStack.length >= 1){
		  alert("请先保存甘特图数据,再进行导入");
		  return ;
	  }
	// cleanTask 就是清楚当前session里面选定的Task 信息
	openWindow('/pm/TailorTemplateTreeAction.do?method=showTemplateTreeFromGantt&cleanTask=1',"ImportWindow");
}
</script>





<div id="gantEditorTemplates" style="display:none;">
<div class="__template__" type="GANTBUTTONS"><!--
  <div class="ganttButtonBar noprint">
    <div class="buttons">
      <button onclick="saveGanttOnServer();" class="button textual icon  hideReadOnly" title="保存"><span class="icon-21"></span></button>
      <button onclick="$('#workSpace').trigger('undo.gantt');return false;" class="button textual icon  hideReadOnly" title="撤销"><span class="icon-uniE900"></span></button>
      <button onclick="$('#workSpace').trigger('redo.gantt');return false;" class="button textual icon  hideReadOnly" title="重做"><span class="icon-1"></span></button>
      <span class="ganttButtonSeparator requireCanWrite requireCanAdd"></span>
      <button class="button textual icon requireCanSeeCriticalPath" onclick="exportToMSProject()" title="导出甘特图" name="submit"><span class="icon-export" ></span></button>
      <span class="ganttButtonSeparator requireCanWrite requireCanAdd"></span>
      <button onclick="beginImport();" class="button textual icon  hideReadOnly pmOnly" title="导入"><span style="font-size:23px" class="icon-ImportFromProject"></span></button>
      <span class="ganttButtonSeparator requireCanWrite requireCanAdd"></span>
      <button onclick="addMoreBelowCurrentTaskOnclick()" class="button textual icon hideReadOnly " title="新增任务"><span class="icon-2"></span></button>
      <button onclick="$('#workSpace').trigger('deleteFocused.gantt');return false;" class="button textual icon delete  hideReadOnly" title="删除任务"><span class="icon--"></span></button>
      <span class="ganttButtonSeparator requireCanWrite requireCanInOutdent"></span>
      <button onclick="$('#workSpace').trigger('cancel.gantt');return false;" class="button textual icon hideReadOnly" title="取消任务"><span class="icon-6"></span></button>
      <button onclick="$('#workSpace').trigger('reuse.gantt');return false;" class="button textual icon hideReadOnly" title="恢复任务"><span class=" icon-7"></span></button>
      <span class="ganttButtonSeparator hideReadOnly"></span>
      <button onclick="$('#workSpace').trigger('copy.gantt');return false;" class="button textual icon hideReadOnly" title="复制任务"><span class="icon-4"></span></button>
      <button onclick="$('#workSpace').trigger('patse.gantt');return false;" class="button textual icon hideReadOnly" title="粘贴任务"><span class="icon-5"></span></button>
      <span class="ganttButtonSeparator hideReadOnly"></span>
      <button onclick="$('#workSpace').trigger('coordinate.gantt');return false;" class="button textual icon hideReadOnly" title="协同/取消协同"><span class="icon-15"></span></button>
      <span class="ganttButtonSeparator hideReadOnly"></span>
      <button onclick="$('#workSpace').trigger('lock.gantt');return false;" class="button textual icon hideReadOnly" title="锁定任务"><span class="icon-9"></span></button>
      <button onclick="$('#workSpace').trigger('unlock.gantt');return false;" class="button textual icon hideReadOnly" title="解锁任务"><span class="icon-8"></span></button>
      <span class="ganttButtonSeparator"></span>
	  <button onclick="$('#workSpace').trigger('moveUpCurrentTask.gantt');return false;" class="button textual icon hideReadOnly requireCanMoveUpDown" title="上移"><span class="icon-10"></span></button>
      <button onclick="$('#workSpace').trigger('moveDownCurrentTask.gantt');return false;" class="button textual icon hideReadOnly requireCanMoveUpDown" title="下移"><span class="icon-11"></span></button>
      <span class="ganttButtonSeparator requireCanWrite requireCanDelete"></span>
      <button onclick="$('#workSpace').trigger('outdentCurrentTask.gantt');return false;" class="button textual icon hideReadOnly " title="升级任务"><span class="icon-12"></span></button>
      <button onclick="$('#workSpace').trigger('indentCurrentTask.gantt');return false;" class="button textual icon hideReadOnly " title="降级任务"><span class="icon-39"></span></button>
      <span class="ganttButtonSeparator requireCanWrite requireCanMoveUpDown"></span>
      <button class="button textual icon requireCanSeeCriticalPath hideReadOnly" onclick="$('#workSpace').trigger('batchAdjustTaskTime.gantt');return false;",'批量调整任务时间')" title="批量调整任务时间" name="submit"><span  class="icon-date"></span></button>
      <span class="ganttButtonSeparator hideReadOnly"></span>
      <button onclick="ge.gantt.showCriticalPath=!ge.gantt.showCriticalPath; ge.redraw();return false;" class="button textual icon requireCanSeeCriticalPath" title="启用/取消显示关键路径"><span class="icon--866"></span></button>
      <span class="ganttButtonSeparator requireCanSeeCriticalPath"></span>
      <button onclick="$('#workSpace').trigger('zoomMinus.gantt'); return false;" class="button textual icon " title="缩小"><span class="icon-13"></span></button>
      <button onclick="$('#workSpace').trigger('zoomPlus.gantt');return false;" class="button textual icon " title="放大"><span class="icon-14"></span></button>
      <span class="ganttButtonSeparator"></span>
      <button onclick="ge.splitter.resize(.1);return false;" class="button textual icon" ><span class="icon-18"></span></button>
      <button onclick="ge.splitter.resize(60);return false;" class="button textual icon" ><span class="icon-19"></span></button>
      <button onclick="ge.splitter.resize(100);return false;" class="button textual icon"><span class="icon-20"></span></button>
      <span class="ganttButtonSeparator hideReadOnly"></span>
       &nbsp; &nbsp;
      <button onclick="window.parent.tabJavaView();" style="width: 90px;font-size: 14px;" class="button textual icon " title="点击，切换至JAVA版"><span class="icon-Java"></span></button>
      <button onclick="window.parent.open('/pm/ganapplets.jar')" style="width: 90px;font-size: 14px;" class="button textual icon " title="点击，下载桌面版甘特图"><span class="icon-29"></span></button>
      <span class="ganttButtonSeparator hideReadOnly"></span>
      	<span style="font-size: 14px;">延期</span><input type="checkbox" name="delayChecked" id="delayChecked" onclick="delaySwitch();" >
      	<input type="hidden" name="delayId" id="delayId" value="" >
      &nbsp; &nbsp; &nbsp; &nbsp;

      	<span style="font-size: 14px;">显示/更新甘特图</span><input type="checkbox" name="needDrawGanttAreaChecked" id="needDrawGanttAreaChecked" onclick="needDrawGanttAreaSwitch();" >
    <button class="button login" title="login/enroll" onclick="loginEnroll($(this));" style="display:none;">login/enroll</button>
    <button class="button opt collab" title="Start with Twproject" onclick="collaborate($(this));" style="display:none;"><em>collaborate</em></button>
    <input type="hidden" id="taskselected" value="">
    </div></div>
  --></div>
<div class="__template__" type="TASKSEDITHEAD"><!--
  <table class="gdfTable" cellspacing="0" cellpadding="0" id="myTable">
    <thead>
    <tr style="height:40px">
      <th class="fixedColumnOne gdfColHeader " align="center" style="width:60px;border-right: not specified;">序号</th>
      <th class="fixedColumnTitle gdfColHeader " colspan="3" style="width:75px;text-align:center">标记</th>
      <th class="gdfColHeader gdfResizable" style="width:100px;display:none">code/short name</th>
      <th class="fixedColumnFive gdfColHeader  gdfResizable" style="width:200px;">任务名称</th>
      <th class="gdfColHeader gdfResizable" style="width:85px;">任务类型</th>
      <th class="gdfColHeader gdfResizable" style="width:100px;">任务负责人</th>
      <th class="gdfColHeader gdfResizable" style="width:80px;">状态</th>
      <th class="gdfColHeader"  align="center" style="width:17px;display:none" title="Start date is a milestone."><span class="teamworkIcon" style="font-size: 8px;">^</span></th>
      <th class="gdfColHeader gdfResizable" style="width:120px;">计划开始时间</th>
      <th class="gdfColHeader"  align="center" style="width:17px;display:none" title="End date is a milestone."><span class="teamworkIcon" style="font-size: 8px;">^</span></th>
      <th class="gdfColHeader gdfResizable" style="width:120px;">计划结束时间</th>
      <th class="gdfColHeader gdfResizable" style="width:85px;" title="计划工作量(人时)">计划工作量</th>
      <th class="gdfColHeader gdfResizable" style="width:500px; text-align: left; padding-left: 10px;">任务成员</th>
	  <th class="gdfColHeader gdfResizable" style="width:120px;">实际开始时间</th>
      <th class="gdfColHeader gdfResizable" style="width:120px;">实际结束时间</th>

      <th class="gdfColHeader gdfResizable" style="width:85px;" title="实际工作量(人时)">实际工作量</th>
      <th class="gdfColHeader gdfResizable" style="width:50px;">工期</th>
      <th class="gdfColHeader gdfResizable" style="width:120px;">任务完成百分比</th>
      <th class="gdfColHeader gdfResizable" style="width:120px;">任务审批人</th>
      <th class="gdfColHeader gdfResizable" style="width:50px;">里程碑</th>
      <th class="gdfColHeader gdfResizable" style="width:50px;">阶段</th>
      <th class="gdfColHeader gdfResizable requireCanSeeDep" style="width:50px;">前置</th>
      <th class="gdfColHeader gdfResizable" style="width:50px;">协同</th>
      <th class="gdfColHeader gdfResizable" style="width:500px;">任务描述</th>


    </tr>
    </thead>
  </table>
  --></div>

<div class="__template__" type="TASKROW"><!--
  <tr id="tid_(#=obj.id#)" taskId="(#=obj.id#)" class="taskEditRow (#=obj.isParent()?'isParent':''#) (#=obj.collapsed?'collapsed':''#)" level="(#=level#)">
    <th class="gdfCell fixedColumnOne" align="center" style="margin: 0px !important; cursor:pointer;border-right: 1px solid rgb(187, 187, 187);border-right: not specified;"><span class="taskRowIndex">(#=obj.getRow()+1#)</span></th>
    <td class="gdfCell fixedColumnTow edit" align="center" style="margin: 0px !important;"><div class="taskStatus cvcColorSquare" status="(#=obj.status#)" isLeft="(#=obj.getChildren().length>0#)"></div></td>
    <td class="gdfCell fixedColumnThree noClip" align="center" style="margin: 0px !important;"><div class="reportStatus cvcColorSquare"  rtype="(#=obj.reportType#)" isReport="(#=obj.qualityReportId!=''&&obj.qualityReportId>0#)"></div></td>
    <td class="gdfCell fixedColumnFour noClip" align="center" style="margin: 0px !important;"><div class="releaseStatus"  (#=(!obj.canWrite||obj.hasChild)?'isDisabled="true"':'isDisabled="false"'#) (#=(obj.isAssigned)?'idChecked=true':'idChecked=false'#) ></div></td>
    <td class="gdfCell" style="display:none" style="margin: 0px !important;"><input type="text" name="code" value="(#=obj.code?obj.code:''#)" placeholder="code/short name"></td>
    <td class="gdfCell fixedColumnFive indentCell" style="margin: 0px !important; padding-left:(#=obj.level*10+18#)px;">
      <div class="exp-controller"  align="center"></div>
      <span  style='display:none;font-size:22px;' id='add_(#=obj.id#)'   class="icon-deferred"></span>
      <input type="text" name="name" value="(#=obj.name#)">
    </td>
    <td class="gdfCell taskType">
    	<select style='width:100%' type="select" id="type_(#=obj.id#)" name="typeId"  class="formElements tableSelectCss"></select>
    </td>
    <td class="gdfCell principalText">
   		<select style='width:100%' type="select" id="principal_(#=obj.id#)" name="principal"  class="formElements tableSelectCss"></select>
    </td>
     <td class="gdfCell " id='taskStatus_(#=obj.id#)'></td>
    <td class="gdfCell" align="center" style="display:none"><input type="checkbox" name="startIsMilestone"></td>
    <td class="gdfCell"><input type="text" name="start"  value="" class="date"></td>
    <td class="gdfCell" align="center" style="display:none"><input type="checkbox" name="endIsMilestone"></td>
    <td class="gdfCell"><input type="text" name="end" value="" class="date"></td>

    <td class="gdfCell"><input type="text" name="planWorkload"  value="" ></td>
    <td class="gdfCell taskAssigs">(#=obj.getAssigsString()#)</td>
    <td class="gdfCell"><input type="text" name="realstart"  value="" class="date"></td>
    <td class="gdfCell"><input type="text" name="realend" value="" class="date"></td>

    <td class="gdfCell"><input type="text" name="realWorkload" value="" ></td>
    <td class="gdfCell"><input type="text" name="duration" autocomplete="off" value="(#=obj.duration#)" maxlength="3"></td>
    <td class="gdfCell"><input type="text" name="progress" class="validated" entrytype="PERCENTILE" autocomplete="off" value="(#=obj.progress?obj.progress:''+'％'#)" (#="readOnly"#)></td>
    <td class="gdfCell approverText">
    	<select style='width:100%' type="select" id="approver_(#=obj.id#)" name="approver"  class="formElements tableSelectCss"></select>
    </td>
    <td class="gdfCell isMilestone">
    	<select style='width:100%' type="select" id="isMilestone_(#=obj.id#)" name="isMilestone"  class="formElements tableSelectCss"></select>
    </td>
    <td class="gdfCell isPhase">
    	<select style='width:100%' type="select" id="isPhase_(#=obj.id#)" name="isPhase"  class="formElements tableSelectCss"></select>
    </td>
    <td class="gdfCell requireCanSeeDep"><input type="text" name="depends" autocomplete="off" value="(#=obj.depends#)" (#=obj.hasExternalDep?"readonly":""#)></td>
    <td class="gdfCell coordinateEdit">(#=obj.coordinateEdit?"是":"否"#)</td>
    <td class="gdfCell descriptionText">(#=obj.getDescription()#)</td>
  </tr>
  --></div>

<div class="__template__" type="TASKEMPTYROW"><!--
  <tr class="taskEditRow emptyRow" >
    <th class="gdfCell fixedColumnOne" style="margin: 0px !important;border-right: not specified;" align="right"></th>
    <td class="gdfCell fixedColumnTow noClip" style="margin: 0px !important" align="center"></td>
    <td class="gdfCell fixedColumnThree" style="margin: 0px !important"></td>
    <td class="gdfCell fixedColumnFour" style="margin: 0px !important"></td>
    <td class="gdfCell fixedColumnFive" style="margin: 0px !important"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>

    <td class="gdfCell"></td>
    <td class="gdfCell"></td>

    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>

    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell requireCanSeeDep"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
    <td class="gdfCell"></td>
  </tr>
  --></div>

<div class="__template__" type="TASKBAR"><!--
  <div class="taskBox taskBoxDiv" taskId="(#=obj.id#)" >
    <div class="layout (#=obj.hasExternalDep?'extDep':''#)">
      <div class="taskStatus" status="(#=obj.status#)"></div>
      <div class="taskProgress" style="width:(#=obj.progress>100?100:obj.progress#)%; background-color:(#=obj.progress>100?'red':'rgb(153,255,51);'#);"></div>
      <div class="milestone (#=obj.startIsMilestone?'active':''#)" ></div>

      <div class="taskLabel"></div>
      <div class="milestone end (#=obj.endIsMilestone?'active':''#)" ></div>
    </div>
  </div>
  --></div>


<div class="__template__" type="CHANGE_STATUS"><!--
    <div class="taskStatusBox">
    <div class="taskStatus cvcColorSquare" status="STATUS_ACTIVE" title="Active"></div>
    <div class="taskStatus cvcColorSquare" status="STATUS_DONE" title="Completed"></div>
    <div class="taskStatus cvcColorSquare" status="STATUS_FAILED" title="Failed"></div>
    <div class="taskStatus cvcColorSquare" status="STATUS_WAITING" title="Waiting" style="display: none;"></div>
    <div class="taskStatus cvcColorSquare" status="STATUS_UNDEFINED" title="Undefined"></div>
        <div class="taskStatus cvcColorSquare" status="STATUS_SUSPENDED" title="Suspended"></div>

    </div>
  --></div>

<!--测试计划  -->
<div class="__template__" type="TEST_REPORT_EDITOR" >
 	<h3 class="taskData" ><span >创建测试计划</span></h3>
   	<hr style="border: 1px solid #dedede;margin-top: 16px;"/>
  <div class="ganttReportEditor" id="reportEditGantt">
  	<div class="divTab" style="height:260px;">
	  <table  cellspacing="0" cellpadding="5" width="100%" class="taskData table" >
	    	<col width="15%"></col>
	    	<col width="20%"></col>
	    	<col width="20%"></col>
	    	<col width="20%"></col>
	    	<col width="20%"></col>
	    	<col width="25%"></col>

	       <tr style="height: 40px;">
		       	<td align="right" ><label >请选择:</label></td>
				<td >
					<input id="action1" type="radio" value="1" name="action" checked="checked"/><label id="titleCreateOrUpdate" >新建测试报告</label>
		        </td>
				<td >
					<input id="action0" type="radio" value="0" name="action"><label >关联其他已有报告</label>
		        </td>
				<td  id="disassociateTd" style="display: none">
					<input id="action2" type="radio" value="2" name="action"><label for="name" class="required">取消报告与任务</label>
		        </td>
		        <td colspan="2"></td>
	      </tr>
	      <tr id="testReportNameTr" style="height: 40px;">
				<td align="right"><label for="name" class="required"><font style="color: red;">*&nbsp;</font>测试报告名称:</label> </td>
		       <td  colspan="3">
		  			<input type="text" name="name" id="taskname" class="formElements" autocomplete='off' maxlength=255 style='width:100%' value="" required="true" oldvalue="1">
		  	   </td>
		  	   <td > </td>
	      </tr>
	      <tr id="testReportPriojectTr" style="height: 40px;">
				<td align="right"><label for="approver"><font style="color: red;">*&nbsp;</font>测试项目:</label> </td>
		        <td  colspan="3">
		        	<select  style='width:100%'  type="select" id="project" name="project"  class="formElements"></select>
		        </td>
		        <td ></td>
	      </tr>
		  <tr id="texistReportTr" style="height: 40px; display: none">
			<td  align="right" >
	        	<label for="name" class="required"><font style="color: red;">*&nbsp;</font>关联报告:</label>
	        </td>
	   		<td colspan="3">
	   		    <select  style='width:100%'  type="select" id="existReport" name="existReport"  class="formElements"></select>
	   		</td>
	   		  <td ></td>
	      </tr>
	 	</table>
    </div>
    <hr id="rootConfirmbtnHR" style="border: 1px solid #dedede;margin-top: 16px;"/>
	  <div style="text-align: center; padding-top: 20px"   id="rootConfirmbtn">
	    <span   class="rootConfirmbtn"  onClick="$(this).trigger('saveTestReportEditor.gantt');">确定</span>
	  </div>
	 <!--  <div style="text-align: content; padding-top: 20px">
	    <span id="saveButton" class="button first" onClick="$(this).trigger('saveTestReportEditor.gantt');">保存</span>
	     <span  class="closebtn"  onClick="$(this).trigger('close');">关闭</span>
	  </div> -->
  </div>
</div>


<!--根节点项目基本  -->

<div class="__template__" type="TASK_PROJECT_INFO" >
  <div  style="width: 100%;  overflow: auto; text-align:center;" id="taskEditGanttProjectInfo">
    <h5 class="hintTitle">信&nbsp;息&nbsp;提&nbsp;示</h5>
      <div>
         <P id="titleInfo">项目的计划开始时间不能晚于计划结束时间2021-11-29</P>
      </div>
	  <div style="text-align: center; padding-top: 20px" >
       <span  class="closebtn"  onClick="$(this).trigger('close');">关闭</span>
	  </div>
	 <!--  <div style="text-align: center; padding-top: 20px" >
       <span  class="closebtn"  onClick="$(this).trigger('close');">关闭</span>
	  </div> -->
  </div>
</div>







 <div class="__template__" type="TASK_PROJECT_EDITOR" >
  <div  style="width: 100%;  overflow: auto; font-size:22px" id="taskEditGanttProject">
    <h3 class="taskData">项目信息</h3>
  	<hr style="border: 1px solid #dedede;margin-top: 16px;"/>
		<table cellspacing="0" width="100%" style="width: 100%;  overflow: auto;border: 12px; border-collapse: collapse; " >
			<col width="50%"></col>
			<col width="50%"></col>
			<col></col>
			<tr class="taskData ">
				<td width="15%" height="15px" align="right" style="border: 18px solid #f9f9f9;"><label for="name"
					class="required" style="font-size:18px">项目名称</label></td>
				<td align="left" style="border: 18px solid #f9f9f9;"><input type="text" name="name" id="name"
					class="formElements" autocomplete='off' maxlength=255
					style='width: 100%;font-size:18px ;border-left:0px;border-top:0px;border-right:0px;border-bottom:1px;background-color: #f9f9f9'
					value="" required="true" oldvalue="1">
					<input type="hidden" name="code" id="code" value="" size=15
					class="formElements" autocomplete='off' maxlength=255
					style='width: 100%' oldvalue="1">
					<input type="hidden" name="empPmId" id="empPmId" value="1"></td>
			</tr>

			<tr class="taskData">
				<td nowrap="" align="right" style="border: 18px solid #f9f9f9;">
					<div style="position: relative">
						<label for="start" style="font-size:18px">计划开始时间</label>
						<!--             <input type="checkbox" id="startIsMilestone" name="startIsMilestone" value="yes"> &nbsp;<label for="startIsMilestone">is milestone</label>&nbsp; -->
					</div>
				</td>
				<td align="left" style="border: 18px solid #f9f9f9;" id="startTr"><input type="text" name="start" id="start"
					size="8" class="formElements dateField validated date" sytle="font-size:18px"
					autocomplete="off" maxlength="255" value="" oldvalue="1"
					entrytype="DATE" style="width: 90px"> <span
					title="calendar" id="starts_inputDate"
					class="teamworkIcon openCalendar icon-rili"
					onclick="$(this).dateField({inputField:$(this).prevAll(':input:first'),isSearchField:false});"></span>
				</td>
			</tr>
			<tr class=" taskData">
				<td nowrap="" align="right" style="border: 18px solid #f9f9f9;"><label for="end" style="font-size:18px;">计划结束时间</label>
					<!--           <input type="checkbox" id="endIsMilestone" name="endIsMilestone" value="yes"> &nbsp;<label for="endIsMilestone">is milestone</label>&nbsp; -->
				</td>
				<td align="left"  style="border: 18px solid #f9f9f9;" id="endTr"><input type="text" name="end" id="end"
					size="8" class="formElements dateField validated date" sytle="font-size:18px;"
					autocomplete="off" maxlength="255" value="" oldvalue="1"
					entrytype="DATE" style="width: 90px"> <span
					title="calendar" id="ends_inputDate"
					class="teamworkIcon openCalendar icon-rili"
					onclick="$(this).dateField({inputField:$(this).prevAll(':input:first'),isSearchField:false});"></span>
				</td>
			</tr>
			<tr class="taskData ">
				<td nowrap="" align="right"  style="border: 18px solid #f9f9f9;">
					<label for="duration" style="font-size:18px" >工期</label>
				</td>
				<td align="left"  style="border: 18px solid #f9f9f9;">
				<input type="text" style='width: 100%;font-size:18px ;border-left:0px;border-top:0px;border-right:0px;border-bottom:1px;background-color: #f9f9f9 '
					name="duration" id="duration" size="4" disabled="disabled"
					class="formElements"
					title="Duration is in working days." autocomplete="off"
					maxlength="3" value="" oldvalue="1" entrytype="DURATIONDAYS">
				</td>
			</tr>
		</table>
	  <hr id="rootConfirmbtnHR" style="border: 1px solid #dedede;margin-top: 16px;"/>
	  <div style="text-align: center; padding-top: 20px"   id="rootConfirmbtn">
	    <span   class="rootConfirmbtn"  onClick="$(this).trigger('fonfirmFullEditor.gantt');">确定</span>
	  </div>
  </div>
</div>


<div class="__template__" type="TASK_EDITOR">
 <h3 class="taskData" ><span id="titleTask">任务属性</span></h3>
   	<hr style="border: 1px solid #dedede;margin-top: 16px;"/>
   	<input type="hidden" name="empPmId" id="empPmId" value="1">
	<div class="ganttTaskEditor " id="taskEditGantt" >
		<div class="tabTitle" style="margin-left: -40px;">
			<ul>
				<li id="detailedInfo" class="current" style="border: 0px solid #abcdef;">基本信息</li>
				<li id="taskUser" style="border: 0px solid #abcdef;">任务成员</li>
				<li id="wordLi" style="border: 0px solid #abcdef;">工作产品</li>
				<li id="dpLi" style="border: 0px solid #abcdef;">前置任务</li>
				<li id="isLoopLi"  style="border: 0px solid #abcdef;">周期性任务</li>
			</ul>
		</div>
	<hr id="firstHR" style="border: 1px solid #dedede;margin-top: -15px;"/>

		<div class="tabContent " >
			<div class="divTab" style="height:320px;overflow:auto">
				<table border='0' cellspacing="0" cellpadding="5" width="100%" class="table">
					<tr class="taskData ">
						<td width="15%"   style="text-align: right;"><font style="color: red;">*&nbsp;</font><label for="name"
							class="required">任务名称</label></td>
						<td colspan="5" style="height:15px">
							<div><input type="text" name="name" id="name" checkInfo=";notnull;float+" onblur="checkInputTaskName(this);"
							class="formElements" autocomplete='off' maxlength=255
							style='width: 100%' value="" required="true" oldvalue="1">
							</div>

						</td>
						<input type="hidden" name="code" id="code" value="" size=15
							class="formElements" autocomplete='off' maxlength=255
							style='width: 100%' oldvalue="1">
					</tr>
					<tr >
						<td class="taskData " style="text-align: right;"><label for="approver">任务类型</label></td>
						<td class="taskData "><select style='width: 100%'
							type="select" id="type" name="type" class="formElements"></select>
						</td>
						<!-- <td class="taskData " style="text-align: right;"  id="dynamicTitle">
						</td>
						<td class="taskData " style="text-align: right;" id="dynamicInput">
						</td>  -->
						<!--  <td><label for="principal">&nbsp;&nbsp;&nbsp;任务负责人</label>
						</td>
						<td><select style='width: 100%' type="select" id="principal"
							name="principal" class="formElements"></select>
						</td>
						<select style='width: 100%;display: none' type="select" id="principal"
							name="principal" class="formElements"></select> -->

						<td style="text-align: right;"><label for="approver">相关项目</label></td>
						<td colspan="5"><select style='width: 100%' type="select"
							id="relatedProject" name="relatedProject" class="formElements"></select>
						</td>

					</tr>

					<tr class="dateRow taskData" readonly="true">
						<td  nowrap="" style="text-align: right;">
							<div style="position: relative">
								<label for="start">计划开始时间</label>
							</div>
						</td>
						<!-- <td class="starte" id="startdateTdinput" style="text-align: left;display:none">
						</td> -->
						<td class="starte" id="startdateTd" style="text-align: left;">
							<input type="text" name="start" id="start" size="8"
								class="formElements dateField validated date" autocomplete="off"
								maxlength="255" value="" oldvalue="1" entrytype="DATE"
								style="width: 100%;" >
						</td>
						<td nowrap="" style="text-align: right;"><label for="end">&nbsp;&nbsp;&nbsp;计划结束时间</label>
						</td>
						<!-- <td class="starte" id="enddateTdinput" style="text-align: left;display:none">
						</td> -->

						<td  id="enddateTd" style="text-align: left;">
							 <input type="text" name="end" id="end" size="8"
							class="formElements dateField validated date" autocomplete="off"
							maxlength="255" value="" oldvalue="1" entrytype="DATE"
							style="width: 100% ;"> <span title="calendar"
							id="ends_inputDate" class="teamworkIcon openCalendar icon-rili"
							onclick="$(this).dateField({inputField:$(this).prevAll(':input:first'),isSearchField:false});"></span>
						</td>
						<!--<td nowrap="" class="duration" ><label for="duration" class=" ">工期</label></td>
						<td class="duration" >
						<input type="text" style='width: 100%' name="duration"
							id="duration" size="4"
							class="formElements validated durationdays"
							title="Duration is in working days." autocomplete="off"
							maxlength="3" value="" oldvalue="1" entrytype="DURATIONDAYS">&nbsp;
						</td>-->
					    <td class="durationTd" style="text-align: right;"><label for="duration">工期</label></td>
						<td class="durationTd">
						   <input type="text" style='width: 100%;' name="duration"
							id="duration" size="4"
							class="formElements validated durationdays"
							title="Duration is in working days." autocomplete="off"
							maxlength="3" value="" oldvalue="1" entrytype="DURATIONDAYS">
						</td>
					</tr>
					<tr class="taskData">
						<td style="text-align: right;">
							<div>
								<label>实际开始时间</label>
							</div>
						</td>
						<td ><label class="relevance_txt"></label></td>

						<td nowrap="" style="text-align: right;"><label>实际结束时间</label>
						</td>

						<td colspan="2"><label class="realend_txt"></label></td>
					</tr>
					<!-- <tr class="taskData " id="relatedProjectTr" >
						<td style="text-align: right;"><label for="approver">相关项目</label></td>
						<td colspan="5"><select style='width: 100%' type="select"
							id="relatedProject" name="relatedProject" class="formElements"></select>
						</td>
					</tr> -->
					<input type="hidden" name="progress" id="progress" size="7"
						class="formElements validated percentile" autocomplete="off"
						maxlength="255" value="" oldvalue="1" entrytype="PERCENTILE">

					<tr class="taskData " id="descriptionTr" >
							<td style="text-align: right;">
								<label for="description">任务描述</label>
							</td>
						<td colspan="5">
							<div>
								<textarea rows="2" cols="20" id="description" name="description"
									class="formElements" style="width: 100%;height:76px;"></textarea>
							</div>
						</td>
					</tr>

					<tr class="taskData " >

						<td colspan="2" valign="top" style="text-align: right;"><input type="checkbox"
							id="isMilestone" name="isMilestone" value="yes"> &nbsp;<label
							for="isMilestone">设为里程碑</label>&nbsp;</td>

						<td colspan="2" valign="top"><input type="checkbox"
							id="isPhase" name="isPhase" value="yes"> &nbsp;<label
							for="isPhase">设为阶段</label>&nbsp;</td>
					</tr>
				</table>
			</div>
			<div class="hide divTab" style="height: 300px;overflow:auto;"  >
			<!-- <h3 id="assigsTable">任务成员</h3> -->
				 <!-- <table cellspacing="1" cellpadding="0" width="100%" id="approverTitle">
					 <colgroup>
						<col width="40%">
						<col width="50%">
						<col width="10%" >
					</colgroup>
					<tr >
						<td  style="width: 120px;"><label
							for="approver">任务审批人</label></td>
						<td  style="text-align: left"><select style='width: 100%'
							type="select" id="approver" name="approver" class="formElements"></select>
						</td>
						<td  style="text-align: left">	<div id="addAssig"><span class="teamworkIcon icon-28"style="cursor: pointer; color: #3399FF; font-size: 16px;"></span></div></td>
					</tr>

				</table> -->
					<div style="height:300px;overflow:auto">
					<div>
					     <div style="display:inline-block;">
						    <table cellspacing="1" cellpadding="0" width="100%" id="approverTitle">
								 <colgroup>
									<col width="40%">
									<col width="60%">
								</colgroup>
								<tr >
									<td  style="width: 180px;"><label
										for="approver">任务审批人</label></td>
									<td  style="text-align: left"><select style='width: 100%'
										type="select" id="approver" name="approver" class="formElements"></select>
									</td>
								</tr>
							</table>
						 </div>
							<div style="display:inline-block;margin-left:350px;" id="addAssig"><span class="teamworkIcon icon-28" style="cursor: pointer; color: #3399FF; font-size: 16px;"></span></div>
					</div>
				<table cellspacing="1" cellpadding="0" width="100%" id="assigsTable" >
					<colgroup>
						<col width="40%">
						<col width="10%">
						<col width="40%">
						<col width="10%">
					</colgroup>
					<tr>
						<th style="width: 100px;background-color: #d7dbdc !important;padding: 7px;">任务成员</th>
						<th style="width: 30px;background-color: #d7dbdc !important;padding: 7px;">负责人</th>
						<th style="width: 30px;background-color: #d7dbdc !important;padding: 7px;">计划工作量（人时）</th>
						<th style="width: 30px;background-color: #d7dbdc !important;padding: 7px;">操作</th>
					</tr>
					<tr></tr>
				</table>
			</div>
			</div>
			<div class="hide divTab" style="height: 300px; overflow: auto;" id="wpTitle">
				<!-- <h3 id="wpTitle">工作产品</h3> -->
				<div style="text-align: right;margin-right: 24px;text-align: right;" id="addWp">
					<span class="teamworkIcon icon-28" style="cursor: pointer; color: #3399FF; font-size: 18px;"></span>
				</div>

				<table cellspacing="1" cellpadding="0" width="100%" id="wpTable">
					<colgroup>
						<col width="30%">
						<col width="20%">
						<col width="20%">
						<col width="10%">
					</colgroup>
					<tr style="background-color: #8fbcda">
						<th style="width: 70px;">工作产品名称</th>
						<th style="width: 30px;">计划规模</th>
						<th style="width: 30px;">单位(类型)</th>
						<th style="width: 30px;" >操作</th>
					</tr>
				</table>
			</div>
			<div class="hide divTab" style="height: 300px; overflow: auto;" id="dpTitle">
				<!-- <h3 id="dpTitle">前置任务</h3> -->
				<div style="text-align: right;margin-right: 24px;text-align: right;" id="addDp">
					<span class="teamworkIcon icon-28" style="cursor: pointer; color: #3399FF; font-size: 18px;"></span>
				</div>

				<table cellspacing="1" cellpadding="0" width="100%" id="dpTable">
					<colgroup>
						<col width="35%">
						<col width="25%">
						<col width="25%">
						<col width="15%">
					</colgroup>
					<tr style="background-color: #8fbcda">
						<th style="width: 70px;">任务名称</th>
						<th style="width: 30px;">关系类型</th>
						<th style="width: 30px;">最小延时</th>
						<th style="width: 30px;" >操作</th>
					</tr>
				</table>
			</div>
			<div  class="hide divTab" style="height: 274px;overflow:auto;" id="loopTitle">
				<input type="hidden" name="days" id="days"><!-- 周几执行-->
				<input type="hidden" name="dayInput" id="dayInput">
				<table border='0' cellspacing="0" cellpadding="5" width="100%" class="table">

					<tr class="taskData" style="background-color: #8fbcda">
						<td width="15%" height="15px"  style="text-align: right;"><label for="name" class="required">重复频率</label></td>
						<td>
						<select  style='width: 20% ;text-align: left'  id="repetition_type"  name="repetition_type" >
							<option value="-1" >不重复</option>
							<option value="0" >每天</option>
							<option value="1">每周</option>
							<option value="2">每月</option>
							<option value="3" >每年</option>
						</select>
							<select  style='width: 20% ;text-align: left' class="loop hide" id="frequency" name="frequency" >
							</select>
							<span id="changeText"></span> </td>
					</tr>
					<tr class="taskData loop hide" id="workDayTr" style="background-color: #8fbcda">
						<td width="15%" height="15px"  style="text-align: right;"><label for="name" class="required">工期</label></td>
						<td>
                            <input type="text" id="workdelay" name="workdelay" maxlength="3"  oninput="if(this.value=='00'||this.value==''){this.value='1';}else{this.value=this.value.replace(/[^0-9]/g,'')}">
                            <span style=" display: block;float: right; margin-right: 63%;padding-top: 8px;">天</span>
                            <div style="width: 39px;  display: block; float: right;">
                                <input class="numberButton" type="button" onclick="addFun('workdelay')" value="+">
                                <input class="numberButton" onclick="subFun('workdelay')" type="button" value="-">
                            </div>
                        </td>
					</tr>
					<tr class="taskData loop hide" style="background-color: #8fbcda">
						<td width="15%" height="15px"  style="text-align: right;">
							<div style="position: relative">
								<label for="startDate">开始日期</label>
							</div>
						</td>
						<td>
							<input type="text" name="startDate" id="startDate" size="8"
								   class="formElements dateField validated date" autocomplete="off"
								   maxlength="255" value="" oldvalue="1" entrytype="LOOP_DATE"
								   style='width: 20% ;text-align: left' >
							<span
									title="calendar" id="startDate_input"
									class="teamworkIcon openCalendar icon-rili"
									onclick="$(this).dateField({inputField:$(this).prevAll(':input:first'),isSearchField:false});"></span>
							</td>
					</tr>
					<tr class="taskData loop hide"  style="background-color: #8fbcda">
						<td width="15%" height="15px"  style="text-align: right;"><label for="name" class="required">结束重复</label></td>
						<td><select id="termType"  name="termType" style='width: 20% ;text-align: left'   >
							<option value="0">限定次数</option>
                            <option value="1">限定时间</option>
						</select>
                          <span id="termType_num">
                                 <span style=" display: block;float: right; margin-right: 50%;padding-top: 8px;">次后</span>
                              <input  style='width: 20% ;text-align: left' id="times" maxlength="3" name="times" oninput="if(this.value=='00'||this.value==''){this.value='1';}else{this.value=this.value.replace(/[^0-9]/g,'')}" >
                              <div style="width: 39px;  display: block; float: right;">
                               <input class="numberButton" type="button" onclick="addFun('times')" value="+">
                               <input class="numberButton" onclick="subFun('times')" type="button" value="-">
                              </div>

                          </span>
                            <span id="termType_date" hidden>
                                <input type="text" name="endDate" id="endDate" size="8"
                                       class="formElements dateField validated date" autocomplete="off"
                                       maxlength="255" value="" oldvalue="1" entrytype="LOOP_DATE_END"
                                       style='width: 20% ;text-align: left' >
                                <span
                                        title="calendar" id="endDate_input"
                                        class="teamworkIcon openCalendar icon-rili"
                                        onclick="$(this).dateField({inputField:$(this).prevAll(':input:first'),isSearchField:false});"></span>
                            </span>
						</td>
					</tr>
				</table>
			</div>

		</div>
   		<hr id="rootConfirmbtnHR" style="border: 1px solid #dedede;margin-top: 0px;"/>

	   <div>
		    	<div style="display:inline-block;" >
			     	<div id="isAssignedTr">
			            <input type="checkbox" id="isAssigned"
								name="isAssigned" value="yes"> &nbsp;<label
								for="isAssigned">发布任务</label>&nbsp;
								<div style="display: none;">
									<select style='width: 100%' id="status" name="status"
										class="formElements" status="(#=obj.status#)"
										onchange="$(this).attr('STATUS',$(this).val());">
										<option value="STATUS_ACTIVE" class="formElements"
											status="STATUS_ACTIVE">进行中</option>
										<option value="STATUS_UNDEFINED" class="formElements"
											status="STATUS_UNDEFINED">未发布</option>
									</select>
								</div>
						</div>
			      </div>
				<p style="display:inline-block;margin-left:18rem;" id="rootConfirmbtnP" class="rootConfirmbtn" style="font-size: 100%;" onClick="$(this).trigger('saveFullEditor.gantt');">确定</p>
		</div>

	</div>
</div>

<div class="__template__" type="TASK_TABLE_DETAILS">
 <h3 class="taskData" ><span id="titleTask">任务属性</span></h3>
   	<hr style="border: 1px solid #dedede;margin-top: 16px;"/>
   	<input type="hidden" name="empPmId" id="empPmId" value="1">
	<div class="ganttTaskEditor " id="taskEditGantt" >
		<div class="tabTitle" style="margin-left: -40px;">
			<ul>
				<li id="detailedInfo" class="current" style="border: 0px solid #abcdef;">基本信息</li>
				<li id="taskUser" style="border: 0px solid #abcdef;">任务成员</li>
				<li id="wordLi" style="border: 0px solid #abcdef;">工作产品</li>
				<li id="dpLi" style="border: 0px solid #abcdef;">前置任务</li>
				<li id="isLoopLi"  style="border: 0px solid #abcdef;">周期性任务</li>
			</ul>
		</div>
	<hr id="firstHR" style="border: 1px solid #dedede;margin-top: -15px;"/>

		<div class="tabContent " >
			<div class="divTab" style="height:300px;">
				<table border='0' cellspacing="0" cellpadding="5" width="100%" class="table">
				<col width="15%"></col>
		    	<col width="10%"></col>
		    	<col width="15%"></col>
		    	<col width="15%"></col>
		    	<col width="15%"></col>
		    	<col width="25%"></col>
					<tr class="taskData ">
						<td width="15%" height="15px"  style="text-align: right;"><label for="name"
							class="required">任务名称</label></td>
						<td colspan="5" id="nameTd"></td>
					</tr>
					<tr >
						<td  class="taskData " style="text-align: right;"><label for="approver">任务类型</label></td>
						<td class="taskData " id="typeTd"></td>

						<!-- <td class="taskData " style="text-align: right;"  id="dynamicTitle"></td>
						<td class="taskData " style="text-align: right;" id="dynamicInput"></td>  -->

						<!-- <td class="principalClass"  style="text-align: right;"><label for="principal">任务负责人</label></td>
						<td class="principalClass"  id="principal_txt"></td>  -->

						<td  style="text-align: right;" ><label for="approver">相关项目</label></td>
						<td  colspan="5" id="relatedProject_txt"> </td>
					</tr>

					<tr class="dateRow taskData" readonly="true">
						<td style="text-align: right;" ><label for="start">计划开始时间</label></td>
						<td class="starte" id="startdateTd" style="text-align: left;"></td>

						<td  style="text-align: right;"><label for="end" >计划结束时间</label> </td>
						<td  id="enddateTd" style="text-align: left;"></td>

					    <td class="durationTd" style="text-align: right;"><label for="duration">工期</label></td>
						<td class="durationTd" id="duration_txt"></td>
					</tr>

					<tr class="taskData">
						<td style="text-align: right;"><label>实际开始时间</label></td>
						<td ><label class="realstart_txt"></label></td>

						<td  style="text-align: right;"><label>实际结束时间</label></td>
						<td ><label class="realend_txt"></label></td>

						<td style="text-align: right;"><label>协同负责人</label></td>
						<td ><label id="coordinateEdit_txt"></label></td>

					</tr>
					<tr class="taskData">
						<td style="text-align: right;">
							<div>
								<label>计划工作量</label>
							</div>
						</td>
						<td ><label class="planWorkload_txt"></label></td>

						<td  style="text-align: right;"><label>实际工作量</label></td>
						<td ><label class="realWorkload_txt"></label></td>

						<td style="text-align: right;"><label>锁定</label></td>
						<td ><label id="isLocked_txt" ></label></td>

					</tr>
					<!-- <tr class="taskData " id="relatedProjectTr" >
						<td style="text-align: right;"><label for="approver">相关项目</label></td>
						<td colspan="5" id="relatedProject_txt"></td>
					</tr> -->
					<tr class="taskData " >
						<td style="text-align: right;" valign="top" ><label for="isPhase">阶段</label>&nbsp;</td>
						<td id="isPhase_txt"> </td>
						<td  valign="top" style="text-align: right;" >
							<label for="isMilestone">里程碑</label></td>
						<td id="isMilestone_txt"> </td>
					</tr>
					<tr class="taskData " id="descriptionTr" >
							<td style="text-align: right;" >
								<label for="description">任务描述</label>
							</td>
						<td colspan="4" id="descriptionTd">
						</td>
					</tr>
				</table>
			</div>
			<div class="hide divTab" style="height: 300px;overflow:auto;"  >
					<div>
					     <div style="display:inline-block;">
						    <table cellspacing="1" cellpadding="0" width="100%" id="approverTitle">
								 <colgroup>
									<col width="40%">
									<col width="60%">
								</colgroup>
								<tr >
									<td style="width: 180px;"><label
										for="approver">任务审批人</label></td>
									<td  style="text-align: left" id="approver_txt">
										<!-- <select style='width: 100%' type="select" id="approver" name="approver" class="formElements"></select> -->
									</td>
								</tr>
							</table>
						 </div>
							<!-- <div style="display:inline-block;margin-left:34rem;" id="addAssig"><span class="teamworkIcon icon-28"style="cursor: pointer; color: #3399FF; font-size: 16px;"></span></div> -->
					</div>
				<table cellspacing="1" cellpadding="0" width="100%" id="assigsTable" >
					<colgroup>
						<col width="40%">
						<col width="10%">
						<col width="40%">
						<col width="10%">
					</colgroup>
					<tr>
						<th style="width: 100px;background-color: #d7dbdc !important;padding: 7px;">任务成员</th>
						<th style="width: 30px;background-color: #d7dbdc !important;padding: 7px;">负责人</th>
						<th style="width: 30px;background-color: #d7dbdc !important;padding: 7px;">计划工作量</th>
						<th style="width: 30px;background-color: #d7dbdc !important;padding: 7px;" class="del">操作</th>
					</tr>
					<tr></tr>
				</table>
			</div>
			<div class="hide divTab" style="height: 300px; overflow: auto;" id="wpTitle">
				<!-- <h3 id="wpTitle">工作产品</h3> -->
				<!-- <div style="text-align: right;margin-right: 24px;text-align: right;" id="addWp">
					<span class="teamworkIcon icon-28" style="cursor: pointer; color: #3399FF; font-size: 20px;"></span>
				</div> -->

				<table cellspacing="1" cellpadding="0" width="100%" id="wpTable">
					<colgroup>
						<col width="30%">
						<col width="20%">
						<col width="20%">
						<col width="10%">
					</colgroup>
					<tr style="background-color: #8fbcda">
						<th style="width: 70px;background-color: #d7dbdc !important;">工作产品名称</th>
						<th style="width: 30px;background-color: #d7dbdc !important;">计划规模</th>
						<th style="width: 30px;background-color: #d7dbdc !important;">单位(类型)</th>
						<th style="width: 30px;background-color: #d7dbdc !important;" class="delWp" >操作</th>
					</tr>
				</table>
			</div>
			<div class="hide divTab" style="height: 300px; overflow: auto;" id="dpTitle">
				<!-- <h3 id="dpTitle">前置任务</h3> -->

				<table cellspacing="1" cellpadding="0" width="100%" id="dpTable">
					<colgroup>
						<col width="40%">
						<col width="30%">
						<col width="30%">
					</colgroup>
					<tr style="background-color: #8fbcda">
						<th style="width: 70px;background-color: #d7dbdc !important;">任务名称</th>
						<th style="width: 30px;background-color: #d7dbdc !important;">关系类型</th>
						<th style="width: 30px;background-color: #d7dbdc !important;">最小延时</th>
					</tr>
				</table>
			</div>
			<!-- show -->
			<div  class="hide divTab" style="height: 274px;overflow:auto;" id="loopTitle">
				<input type="hidden" name="days" id="days"><!-- 周几执行-->
				<input type="hidden" name="dayInput" id="dayInput">
				<table border='0' cellspacing="0" cellpadding="5" width="100%" class="table">

					<tr class="taskData" style="background-color: #8fbcda">
						<td width="15%" height="15px"  style="text-align: right;"><label for="name" class="required">重复频率</label></td>
						<td>
						<select  style='width: 20% ;text-align: left'  id="repetition_type"  name="repetition_type" disabled="disabled" >
							<option value="-1" >不重复</option>
							<option value="0" >每天</option>
							<option value="1">每周</option>
							<option value="2">每月</option>
							<option value="3" >每年</option>
						</select>
							<select  style='width: 20% ;text-align: left' class="loop hide" id="frequency" name="frequency" disabled="disabled">
							</select>
							<span id="changeText"></span> </td>
					</tr>
					<tr class="taskData loop hide" id="workDayTr" style="background-color: #8fbcda">
						<td width="15%" height="15px"  style="text-align: right;"><label for="name" class="required">工期</label></td>
						<td>
                            <input disabled="disabled" type="text" id="workdelay" name="workdelay" maxlength="3"  oninput="if(this.value=='00'||this.value==''){this.value='1';}else{this.value=this.value.replace(/[^0-9]/g,'')}">天
                            <!-- <div style="width: 39px;  display: block; float: right;">
                                <input class="numberButton" type="button" onclick="addFun('workdelay')" value="+">
                                <input class="numberButton" onclick="subFun('workdelay')" type="button" value="-">
                            </div> -->
                        </td>
					</tr>
					<tr class="taskData loop hide" style="background-color: #8fbcda">
						<td width="15%" height="15px"  style="text-align: right;">
							<div style="position: relative">
								<label for="startDate">开始日期</label>
							</div>
						</td>
						<td>
							<input type="text" name="startDate" id="startDate" size="8" disabled="disabled"
								   class="formElements dateField validated date" autocomplete="off"
								   maxlength="255" value="" oldvalue="1" entrytype="LOOP_DATE"
								   style='width: 20% ;text-align: left' >
							<span
									title="calendar" id="startDate_input"
									class="teamworkIcon openCalendar icon-rili"
									onclick="$(this).dateField({inputField:$(this).prevAll(':input:first'),isSearchField:false});"></span>
							</td>
					</tr>
					<tr class="taskData loop hide"  style="background-color: #8fbcda">
						<td width="15%" height="15px"  style="text-align: right;"><label for="name" class="required">结束重复</label></td>
						<td><select id="termType"  name="termType" style='width: 20% ;text-align: left' disabled="disabled"  >
							<option value="0">限定次数</option>
                            <option value="1">限定时间</option>
						</select>
                          <span id="termType_num">

                              <input  style='width: 20% ;text-align: left' id="times" maxlength="3" name="times" disabled="disabled" oninput="if(this.value=='00'||this.value==''){this.value='1';}else{this.value=this.value.replace(/[^0-9]/g,'')}" >
                               <span >次后</span>

                          </span>
                            <span id="termType_date" hidden>
                                <input type="text" name="endDate" id="endDate" size="8" disabled="disabled"
                                       class="formElements dateField validated date" autocomplete="off"
                                       maxlength="255" value="" oldvalue="1" entrytype="LOOP_DATE_END"
                                       style='width: 20% ;text-align: left' >
                                <span
                                        title="calendar" id=" endDate_input"
                                        class="teamworkIcon openCalendar icon-rili"
                                        onclick="$(this).dateField({inputField:$(this).prevAll(':input:first'),isSearchField:false});"></span>
                            </span>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</div>



<div class="__template__" type="ASSIGNMENT_ROW"><!--
  <tr taskId="(#=obj.task.id#)" assId="(#=obj.assig.id#)" class="assigEditRow" >
    <td align="center"><select style='width:75%' name="resourceId"  class="formElements assSelect" (#=obj.assig.id.indexOf("tmp_")==0?"":""#)  ></select> <label id="resourceName_txt" style="display:none;"> (#=obj.resourceName_txt #)</label></td>
    <td  style="display:none;"><select type="select" name="roleId"  class="formElements"></select></td>
    <td align="center"><input id="principalRadioId" type="radio" (#=obj.principalRadio?"checked":""#) name="principalRadio" /></td>
    <td align="center"><input type="text" name="effort" value="(#=obj.assig.effort!=null?obj.assig.effort/1000.0/3600.0:''#)" oninput="upperCase(this)"  size="5" maxlength="8" class="formElements">
     <label id="effort_txt" style="display:none">(#=obj.assig.effort!=null?obj.assig.effort/1000.0/3600.0:''#)</label>
    </td>
    <td align="center" id="del"><span class="teamworkIcon delAssig del icon-30" style="cursor: pointer;font-size:15px;"></span></td>
  </tr>
  --></div>


<div class="__template__" type="WORKPRODUCT_ROW"><!--
  <tr taskId="(#=obj.wp.taskId#)" productId="(#=obj.wp.productId#)" class="assigEditRow" >
    <td align="center">(#=obj.wp.productName#)</td>
    <td align="center"><input type="text" name="planSize" value="(#=obj.wp.planSize#)" size="5" oninput="if(this.value=='00'||this.value==''){this.value='0';}else{this.value=this.value.replace(/[^0-9]/g,'')}" class="formElements" maxlength="8"><label id="planSize_txt" style="display:none">(#=obj.wp.planSize#)</label></td>
    <td align="center">(#=obj.wp.sizeUnitStr#)</td>
    <input type="hidden" name="parentId" value="(#=obj.wp.parentId#)"  />
    <input type="hidden" name="productName" value="(#=obj.wp.productName#)" />
    <input type="hidden" name="sizeUnitStr" value="(#=obj.wp.sizeUnitStr#)" />
    <td align="center" id="delWp"><span class="teamworkIcon delWp del icon-30" style="cursor: pointer;font-size:15px;"></span></td>
  </tr>
  --></div>

<div class="__template__" type="DEPENDS_ROW"><!--
  <tr class="assigEditRow" depends>
    <td align="center"><select style='width:75%' name="taskId"  class="formElements assSelect"  ></select> <label id="taskId_txt" style="display:none"></label></td>

    <td align="center"><select style='width:75%' name="type"  class="formElements assSelect"  ></select><label id="type_txt" style="display:none"></label></td>
    <td align="center"><input type="text" name="delayDay" value="0" size="5" oninput="if(this.value=='00'||this.value==''){this.value='0';}else{this.value=this.value.replace(/[^0-9]/g,'')}" class="formElements" maxlength="5"/><label id="delayDay_txt" style="display:none"></label></td>
    <td align="center" id="delDp"><span class="teamworkIcon delDp del icon-30" style="cursor: pointer;font-size:15px;"></span></td>
  </tr>
  --></div>

<div class="__template__" type="RESOURCE_EDITOR"><!--
  <div class="resourceEditor" style="padding: 5px;">

    <h2>Project team</h2>
    <table  cellspacing="1" cellpadding="0" width="100%" id="resourcesTable">
      <tr>
        <th style="width:100px;">name</th>
        <th style="width:30px;" id="addResource"><span class="teamworkIcon" style="cursor: pointer">+</span></th>
      </tr>
    </table>

    <div style="text-align: right; padding-top: 20px"><button id="resSaveButton" class="button big">Save</button></div>
  </div>
  --></div>



<div class="__template__" type="RESOURCE_ROW"><!--
  <tr resId="(#=obj.id#)" class="resRow" >
    <td ><input type="text" name="name" value="(#=obj.name#)" style="width:100%;" class="formElements"></td>
    <td align="center"><span class="teamworkIcon delRes del" style="cursor: pointer">d</span></td>
  </tr>
  --></div>


</div>
<script type="text/javascript">
  $.JST.loadDecorator("RESOURCE_ROW", function(resTr, res){
    resTr.find(".delRes").click(function(){$(this).closest("tr").remove()});
  });
  var prevValue="";
  $.JST.loadDecorator("ASSIGNMENT_ROW", function(assigTr, taskAssig){
    var resEl = assigTr.find("[name=resourceId]");
    var opt = $("<option>");
    resEl.append(opt);
    var resources =taskAssig.task.master.resources;
    if(taskAssig.acTypeId =="R")
    	resources =taskAssig.task.master.allResources;
    if(taskAssig.acTypeId =="Q")
    	resources =taskAssig.task.master.qaResources;
    for(var i=0; i< resources.length;i++){
      var res = resources[i];
      opt = $("<option>");
      opt.val(res.id).html(res.name);
      if(taskAssig.assig.resourceId == res.id)
        opt.attr("selected", "true");
      resEl.append(opt);
    }
    var roleEl = assigTr.find("[name=roleId]");
    for(var i=0; i< taskAssig.task.master.roles.length;i++){
      var role = taskAssig.task.master.roles[i];
      var optr = $("<option>");
      optr.val(role.id).html(role.name);
      if(taskAssig.assig.roleId == role.id)
        optr.attr("selected", "true");
      roleEl.append(optr);
    }

    if(taskAssig.task.canWrite){
      assigTr.find(".delAssig").click(function(){
    	 if(!assigTr.find("[name=resourceId]").val()||assigTr.find("[name=resourceId]").val()==""||!queryIsTaskReport(taskAssig.task,assigTr,assigTr.find("[name=resourceId]").val())){
      		  var tr = $(this).closest("[assId]").fadeOut(200, function(){$(this).remove()});
    	 }else{
    		var username = assigTr.find("[name=resourceId]").find("option:selected").text();
    		 alert("["+username+"]已填写了任务报告，不能从任务中删除");
    	 }
      });

    //更改成员验证报告期是否填写
	assigTr.find('[name="resourceId"]').on('focus',function(){
		prevValue=$(this).val();
	}).on('change',function(){
		var assigTrT = $(this);

		var num=0;
		var assigRowT = $(this);
		var assigsTable = $("#assigsTable");
		if(assigRowT.val()!=""){
			//alert(assigRowT.val());
			assigsTable.find("tr[assId]").each(
					function() {
						var trAss = $(this);
						var resourceId = trAss.find("[name=resourceId]").val();
						if(assigRowT.val()==resourceId){
							num++;
						}
				});
		}

		if(assigRowT.val()!=""&&num>1){
			alert("已存在【"+getResourcesName(assigRowT.val(),taskAssig.task)+"】,不可重复添加");
			assigRowT.val(prevValue);
		}else{
			var falg=queryIsTaskReport(taskAssig.task,assigTr,prevValue);
			if(falg&&prevValue!=""){
				var username = getResourcesName(prevValue,taskAssig.task);
	   		 	alert("["+username+"]已填写了任务报告，不能更改成员");
				assigTrT.val(prevValue);
			}
		}
	});

	if(!taskAssig.task.coordinateEdit){
		var principalRadioChcke="";
		assigTr.find('[name="principalRadio"]').on('focus',function(){
			principalRadioChcke=assigTr.find("[name=resourceId]").val();
		}).on('change',function(){
			var assigTrT = $(this);
			var resourceIdVal=assigTr.find('[name="resourceId"]').val();
			if(resourceIdVal!=""){
				var principalVal="";
				if(taskAssig.task.typeId=="Q"){
					for ( var i = 0; i < taskAssig.task.master.qaResources.length; i++) {
						var res = taskAssig.task.master.qaResources[i];
						if (resourceIdVal == res.id){
							principalVal=res.id;
						}
					}
				}else{
					for ( var i = 0; i < taskAssig.task.master.resources.length; i++) {
						var res = taskAssig.task.master.resources[i];
						if (resourceIdVal == res.id){
							principalVal=res.id;
						}
					}
				}

				/* if(taskAssig.task.coordinateEdit){
					alert("当前任务已经被协同,不能修改任务负责人");
					assigTrT[0].checked=false;
				} */

				if(principalVal==""){
					alert("所选任务负责人不属于本项目人员,请重新选择");
					assigTrT[0].checked=false;
				}
			}else{
				alert("所选任务负责人不能为空,请重新选择");
				assigTrT[0].checked=false;
			}
		});
	}else{
		assigTr.find('[name="principalRadio"]').each(function() {
			this.disabled=true;
			if($(this).is(":checked")){
				var tr=$(this).closest("tr");
				tr.find("#del").empty();
				tr.find("[name=resourceId]").attr("disabled",true);
				tr.find("[name=effort]").attr("disabled",true);
			}
		});
	}
    }
 });

  $.JST.loadDecorator("WORKPRODUCT_ROW", function(wpTr, taskWp){

	  wpTr.find(".delWp").click(function(){
	        var tr = $(this).closest("[productId]").fadeOut(200, function(){$(this).remove()});
	      });

  });
  $.JST.loadDecorator("DEPENDS_ROW", function(dpTr, dpArg){
	  var curTask = dpArg.task;
	  var dp =  dpArg.dp;
      var lag = 0;
      var type = 1;
      var index = "";
	  if(dp!=undefined){
		  var depString = dp;
		  var supStr =dp;
	      var pos = depString.indexOf(":");
	      var pos2 = depString.indexOf("-");
	      index = supStr;
	      if (pos>0&&pos2<0){
	        supStr=depString.substr(0,pos);
	        var lagStr=depString.substr(pos+1);
	        lag=Math.ceil((stringToDuration(lagStr)) / Date.workingPeriodResolution) * Date.workingPeriodResolution;
	        index = supStr;
	      }else if (pos>0&&pos2>0){
	          supStr=depString.substr(0,pos);
	          var lagStr=depString.substr(pos+1,pos2);
	          var typeStr=depString.substr(pos2+1);
	          lag=Math.ceil((stringToDuration(lagStr)) / Date.workingPeriodResolution) * Date.workingPeriodResolution;
	          if(typeStr=="FS"){
	        	  type = 1;
	          }else if(typeStr=="FF"){
	        	  type = 0;
	          }else if(typeStr=="SS"){
	        	  type = 2;
	          }else if(typeStr=="SF"){
	        	  type = 3;
	          }
		        index = supStr;
	        }else if (pos<0&&pos2>0){
	            supStr=depString.substr(0,pos2);
	            var typeStr=depString.substr(pos2+1);
	            lag=0;
	            if(typeStr=="FS"){
	          	  type = 1;
	            }else if(typeStr=="FF"){
	          	  type = 0;
	            }else if(typeStr=="SS"){
	          	  type = 2;
	            }else if(typeStr=="SF"){
	          	  type = 3;
	            }
		        index = supStr;
	          }
// 		  	alert(index);
// 		  	alert(lag);
// 		  	alert(type);
	  	}
	    var taskEl = dpTr.find("[name=taskId]");
	    var opt = $("<option>");
	    taskEl.append(opt);
	    var tasks = curTask.master.tasks;

	    for(var i=0; i< tasks.length;i++){
	      var task = tasks[i];
	      opt = $("<option>");
	      opt.val(i+1).html(task.name+"("+(i+1)+")").attr("taskName", task.name);
	      if(curTask.id != task.id&&task.id !="tmp_-1")
		      taskEl.append(opt);
	    }
	    if(index.length>0){
	    	taskEl.val(index);
	    }

	    taskEl.change(function (){
	    	var num=0;
			var taskIdEl = $(this);
			if(taskIdEl.val()!=""){
				taskIdEl.closest("#dpTable").find("tr").each(
						function() {
							var trD = $(this);
							var tId = trD.find("[name=taskId]").val();
							if(taskIdEl.val()==tId){
								num++;
							}
					});
			}

			if(taskIdEl.val()!=""&&num>1){
				alert("已存在相同任务,不可重复添加");
				taskIdEl.val("");
			//	taskIdEl.closest("tr").find("[name=taskName]").eq(0).text("");
			}else{
				if(taskIdEl.val()!=""){
					var selectedOp = taskIdEl.find("option:selected").eq(0);
			//		taskIdEl.closest("tr").find("[name=taskName]").eq(0).text(selectedOp.attr("taskName"));
				}
			}
		});

	    if(taskEl.val()!=""){
			var selectedOp = taskEl.find("option:selected").eq(0);
			//taskEl.closest("tr").find("[name=taskName]").eq(0).text(selectedOp.attr("taskName"));
		    dpTr.find("#taskId_txt").text(selectedOp.text());
		}

	    var typeEl = dpTr.find("[name=type]");
	    var type0 = $("<option>");
	    type0.val(0).html("完成-完成");
	    typeEl.append(type0);
	    var type1 = $("<option>");
	    type1.val(1).html("完成-开始");
	    typeEl.append(type1);
	    var type2 = $("<option>");
	    type2.val(2).html("开始-开始");
	    typeEl.append(type2);
	    var type3 = $("<option>");
	    type3.val(3).html("开始-完成");
	    typeEl.append(type3);
	    typeEl.val(type);
	    var selectedOp = typeEl.find("option:selected").eq(0);
	    dpTr.find("#type_txt").text(selectedOp.html());
	    var lagEl = dpTr.find("[name=delayDay]");
	    lagEl.val(lag);
	    dpTr.find("#delayDay_txt").text(lag);
	  	dpTr.find(".delDp").click(function(){
	        var tr = $(this).closest("[depends]").fadeOut(200, function(){$(this).remove()});
	      });

  });
  var wpCurrenttaskId = "";

  function loadI18n(){
    GanttMaster.messages = {
      "CANNOT_WRITE":"没有权限操作此任务",
      "CHANGE_OUT_OF_SCOPE":"因为父级限制无法进行此次修改",
      "START_IS_MILESTONE":"开始时间无法变更，原因可能是：期望的调整后起止日期超出项目起止日期限制。修改项目起止日期需进行计划变更。",
      "END_IS_MILESTONE":"结束时间无法变更，原因可能是：期望的调整后起止日期超出项目起止日期限制。修改项目起止日期需进行计划变更。",
      "TASK_HAS_CONSTRAINTS":"任务存在依赖无法进行此次修改",
      "GANTT_ERROR_DEPENDS_ON_OPEN_TASK":"由于进行任务无法更新",
      "GANTT_ERROR_DESCENDANT_OF_CLOSED_TASK":"由于关闭任务无法更新",
      "TASK_HAS_EXTERNAL_DEPS":"任务有其他依赖",
      "GANNT_ERROR_LOADING_DATA_TASK_REMOVED":"加载甘特图时发现任务信息不正确，该任务无法正确被加载进甘特图，请检查甘特图拆分情况，重新拆分并保存甘特图",
      "CIRCULAR_REFERENCE":"操作导致循环依赖",
      "CANNOT_CREATE_SAME_LINK":"操作导致依赖条件重复冲突",
      "CANNOT_DEPENDS_ON_ANCESTORS":"不能依赖祖先",
      "INVALID_DATE_FORMAT":"数据格式错误",
      "GANTT_ERROR_LOADING_DATA_TASK_REMOVED":"数据加载错误，有任务已丢失",
      "CANNOT_CLOSE_TASK_IF_OPEN_ISSUE":"不能关闭存在缺陷的任务",
      "TASK_MOVE_INCONSISTENT_LEVEL":"当前任务已经在最上方了，无法继续上移",
      "TASK_MOVE_INCONSISTENT_DOWN_LEVEL":"当前任务已经在最下方了，无法继续下移",
      "CANNOT_MOVE_TASK":"不能移动",
      "FORM_IS_CHANGED":"当前页面有未保存的内容，请确认！",
      "PLEASE_SAVE_PROJECT":"请保存项目",
      "GANTT_SEMESTER":"半年",
      "GANTT_SEMESTER_SHORT":"半年.",
      "GANTT_QUARTER":"季度",
      "GANTT_QUARTER_SHORT":"季度.",
      "GANTT_WEEK":"周",
      "GANTT_WEEK_SHORT":"周.",
      "ROOT_EDIT_MSG":"不支持编辑项目节点",
      "TASK_ADD_CHILDREN":"已发布的任务不能添加子任务",
      "TASK_CANCEL":"无法取消，任务已经为取消状态",
      "TASK_PARENT_CANCEL":"存在子任务，无法取消",
      "TASK_REUSE":"无法恢复，任务已经处于正常状态",
      "TASK_CURRENT":"不支持编辑项目节点",
      "TASK_COORDINATE_EDIT":"任务未协同,无法锁定",
      "TASK_LOCKED_ERROR":"任务已被锁定,无法再次锁定，请先解锁",
      "TASK_UNLOCK":"解锁成功",
      "TASK_LOCK":"锁定成功",
      "TASK_NO_LOCK":"无权锁定",
      "TASK_NO_PRINCIPAL":"请选择任务负责人",
      "OPERATION_SUCCEE":"操作成功",
      "COORDINATION_SUCCEE":"协同成功",
      "NO_COORDINATION_SUCCEE":"取消协同",
      "TASK_IS_LOCKED":"任务已锁定",
      "TASK_NAME_LENGTH_ERROR":"任务名称过长，请不要超过120个字",
      "CAN_NOT_PATSE":"已发布的任务节点不允许粘贴",
      "ADD_LOOP_TASK_ERROR":"此任务已被设置为周期性任务，不能新建其他任务",
      "ADD_LOOP_TASK_PARENT_ERROR":"父任务已被设置为周期性任务，不能新建其他任务",
      "COPY_LOOP_TASK_ERROR":"此任务已被设置为周期性任务，不允许复制",
      "COPY_LOOP_TASK_PARENT_ERROR":"父任务已被设置为周期性任务，不允许复制",
    };
  }



  function createNewResource(el) {
    var row = el.closest("tr[taskid]");
    var name = row.find("[name=resourceId_txt]").val();
    var url = contextPath + "/applications/teamwork/resource/resourceNew.jsp?CM=ADD&name=" + encodeURI(name);

    openBlackPopup(url, 700, 320, function (response) {
      //fillare lo smart combo
      if (response && response.resId && response.resName) {
        //fillare lo smart combo e chiudere l'editor
        row.find("[name=resourceId]").val(response.resId);
        row.find("[name=resourceId_txt]").val(response.resName).focus().blur();
      }

    });
  }
  function isModify(){
	  return ge.__undoStack.length > 0;
  }

  //校验已分配的任务增加提示信息
  function addMoreBelowCurrentTaskOnclick(){
 	  if(ge&&ge.currentTask.isAssigned){
		  alert('<bean:message key="projmgr.wbs.gantt.assigned.tasks.error" />');//已分配的任务不能添加子任务
	  }else{
		  var taskType= $('#workSpace').trigger('addMoreBelowCurrentTask.gantt');
	  }
	  return false;
  }
  /* 导出甘特图  */
  function exportToMSProject(){
	  window.open('/pm/pm/twGantt/showExportWay.jsp?projectId=1&logId=-1',"_blank","width=800,height=200,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
  }


  function  needDrawGanttAreaSwitch(){
	  var needDrawGanttAreaChecked=$("input[name='needDrawGanttAreaChecked']:checked").val();

	  if("on"==needDrawGanttAreaChecked){
	  	ge.needDrawGanttArea = true;
	  	ge.splitter.resize(60);
	  	if (localStorage) {
	        localStorage.setItem("NFSneedDrawGanttArea", 1);
	  	}
	    ge.gantt.redraw();
	  }else{
		  ge.splitter.resize(100);
		  ge.needDrawGanttArea = false;
		  if (localStorage) {
		        localStorage.setItem("NFSneedDrawGanttArea", 0);
		  }
	  }

		//console.log("selfMaster.needDrawGanttArea: " + ge.needDrawGanttArea);

  }
  /* 设置用户延期显示标识  */
  function  delaySwitch(){
	  var delayChecked=$("input[name='delayChecked']:checked").val();
	  var delayId=$("#delayId").val();
	   $.ajax({
			type:'POST',
			url:"/pm/GanttAppletNewAction.do?method=setDelaySwitch",
			data:{
				delaySwitchValue:delayChecked,
				projectId:1,
				delaySwitchId:delayId
			},
			datatype:"json",
			async:true,
	 		success: function(jsonResult){
	 			$("#delayId").val(jsonResult.delayId);
	 			if(jsonResult.delayValue&&jsonResult.delayValue.indexOf("true")==0){
	 				$.each($("span[isdelay='false']"),function(key){
	 					$("span[isdelay='false']").show();
	 					$("span[isdelay='false']").empty();
	 				})
	 			}else{
	 				$.each($("span[isdelay='false']"),function(key){
	 					$("span[isdelay='false']").hide();
	 					$("span[isdelay='false']").empty();
	 				})
	 			}
			},
			error:function(){
				alert("加载失败,服务器无响应");
			}
		});

  }

  /* 初始化延期开关 */
  function  initDelaySwitch(){
	  var delayChecked=$("input[name='delayChecked']:checked").val();
	  var delayId=$("#delayId").val();
	  var falg=false;
	   <!-- $.ajax({ -->
			<!-- type:'POST', -->
			<!-- url:"/pm/GanttAppletNewAction.do?method=setDelaySwitch", -->
			<!-- data:{ -->
				<!-- delaySwitchValue:delayChecked, -->
				<!-- projectId:1, -->
				<!-- delaySwitchId:delayId -->
			<!-- }, -->
			<!-- datatype:"json", -->
			<!-- async:false, -->
	 		<!-- success: function(jsonResult){ -->
	 			<!-- $("#delayId").val(jsonResult.delayId); -->
	 			<!-- if(jsonResult.delayValue&&jsonResult.delayValue.indexOf("true")==0){ -->
	 				<!-- $("input:checkbox:first").attr("checked",true); -->
	 				<!-- falg=true; -->
	 			<!-- }else{ -->
	 				<!-- $("input:checkbox:first").attr("checked",false); -->

	 			<!-- } -->
			<!-- },  -->
			<!-- error:function(){ -->
				<!-- alert("加载失败,服务器无响应"); -->
			<!-- } -->
		<!-- }); -->
	   return falg;
  }


  function  checkInputTaskName(obj){
	  var dispObj = QoneForm.getDispObj(obj);
	 	var value = obj.value;
		if(value ==null || value == ""||value.trim()==""){
			dispObj.innerHTML = '请输入任务名称 ';
			dispObj.style.color = "red";
			return false;
		}else{
			dispObj.remove();
		}
		return true;
  }

  /*测试计划  评审计划,审核计划回显  */
  function  checkTaskPlan(obj){

  	var task = selfMaster.getTask(obj.taskId);
  	var testReports = selfMaster.testReports;

  	var editorRow = task.rowElement;
  	if(task.reportType=="T"){
		var testReport;
		for (var int = 0; int < testReports.length; int++) {
			if(testReports[int].testReportId ==  task.qualityReportId){
				testReport = testReports[int];
			}
		}

	  	if (obj.action == 1){
	  	      if (testReport){ //修改报告
	  	    	selfMaster.beginTransaction();
	  	        testReport.reportTitle = obj.reportTitle;
	  	      	testReport.testProjectId = obj.testProjectId;
	  	      	testReport.securityLevel = obj.securityLevel;
	  	        if(testReport.status==0) {
	  	          testReport.status=-2;
	  	        }
	  		     selfMaster.endTransaction();
	  	      } else{ //创建报告
	  	    	selfMaster.beginTransaction();
	  	        var newTestReport = new TestReport(obj.reportTitle,selfMaster.projectId, obj.testProjectId);
	  	        newTestReport.setNew();
	  	        newTestReport.status=-1;
	  	        newTestReport.testProjectId = obj.testProjectId;
	  	        newTestReport.securityLevel = obj.securityLevel;

	  	       	selfMaster.testReports.push(newTestReport);
	  	        task.qualityReportId = newTestReport.testReportId;
	  	        selfMaster.endTransaction();
	  	      }
	  	    editorRow.find(".reportStatus").attr("isreport",true);

	  	}else if (obj.action == 0){
	  	 	selfMaster.beginTransaction();
	        task.qualityReportId = obj.testReportId;
	        selfMaster.endTransaction();
	    }else if (obj.action == 2){
	  	  	selfMaster.beginTransaction();
	        task.qualityReportId = -1;
	        selfMaster.endTransaction();
	        editorRow.find(".reportStatus").attr("isreport",false);
	    }
  	}

  	//评审

  	//审核


 }




  /*ajax 查询当前成员是否填写任务报告  */
  function  queryIsTaskReport(task,assigTr,resourceId){
	  var falg=false;
	 // // var resourceId=assigTr.find("[name=resourceId]").val();
	 //  $.ajax({
		// 	type:'POST',
		// 	url:"/pm/ManageTaskReportDispatchAction.do?method=getSingleTaskReportForFillByType&t="+new Date().getTime(),
		// 	data:{
		// 		empId:resourceId,
		// 		queryTaskId:task.id,
		// 		queryProjectId:task.master.projectId,
		// 		queryReportDate:new Date(task.start).format()
		// 	},
		// 	datatype:"json",
		// 	async:false,
	 // 		success: function(jsonResult){
	 // 			if(jsonResult.success){
	 // 				falg=true;
	 // 			}
		// 	},
		// 	error:function(){
		// 		alert("加载失败,服务器无响应");
		// 	}
		// });
	   return falg;

  }

  /*ajax 获取当前任务时间段里，工作日天数  */
  function  getWorkDayCountNum(projectId,startDate,endDate){
	  var falg=0;
	 // var resourceId=assigTr.find("[name=resourceId]").val();
	 //  $.ajax({
		// 	type:'POST',
		// 	url:"/pm/ResetWorkDayInfoAction.do?method=getWorkDayCountNum&t="+new Date().getTime(),
		// 	data:{
		// 		projectId:projectId,
		// 		startDate:startDate,
		// 		endDate:endDate
		// 	},
		// 	datatype:"json",
		// 	async:false,
	 // 		success: function(jsonResult){
	 // 			if(jsonResult.success){
	 // 				falg=jsonResult.success;
	 // 			}
		// 	},
		// 	error:function(){
		// 		alert("加载失败,服务器无响应");
		// 	}
		// });
	   return falg;

  }


  /* 任务成员计划工作量校验 */
  function  upperCase(obj){

	  if(/^-$/.test(obj.value)){
		obj.value="";
	  }else if(!/^[+-]?\d*\.{0,1}$/.test(obj.value)){
		 obj.value=obj.value.replace(/\.\d{2,}$/,obj.value.substr(obj.value.indexOf('.'),3));
	  }

	}


	function showdiv(message){


	}
	function hidediv(){

	}
</script>






</body>
</html>
